#include "napi/native_api.h"
#include <string>

enum PLAYER_COMMAND {
    PLAY = 0,
    PLAY_FROM_START,
    PAUSE,
    STOP,
    EXPORT
};

struct AsyncPlayer {
    napi_async_work work;
    napi_deferred deferred;
    napi_value promise;
    bool success{false}; // 这里的success只能感知到启动相应操作在调用编解码接口时是否成功
    void* data{nullptr};
    PLAYER_COMMAND command{PLAYER_COMMAND::PLAY};
};

namespace AsyncWork{
    AsyncPlayer* CreateAsyncPlayer(napi_env env, PLAYER_COMMAND command);
}